<?php

// 本类由系统自动生成，仅供测试用途
class PoolAction extends CommonAction {

    public function index() {

        $this->assign('pagetitle', 'IP pool');
        $this->display();
    }

    public function show() {

    	$regM = M('pool');
    	$rawPools = $regM->select();

    	$this->assign('rawPools', $rawPools);
    	$this->assign('pagetitle', 'IP pool | Show');
    	$this->assign('poolShowActive', 'active');
    	
    	$this->display();
    }

    public function insert() {

    	$this->assign('pagetitle', 'IP pool | Insert');
    	$this->assign('poolInsertActive', 'active');
    	
    	$this->display();
    }

    public function update() {

    	$regM = M('pool');
    	$rawPools = $regM->select();

    	$this->assign('rawPools', $rawPools);
    	$this->assign('pagetitle', 'IP pool | Update');
    	$this->assign('poolUpdateActive', 'active');
    	
    	$this->display();
    }



    public function doinsert() {
    	
    	$formData = $_POST;

    	$regM = M('pool');

    	$regM -> add($formData);

        $this->redirect('Pool/insert');
    }


    public function doupdate() {

        $formData = $_POST;

        $id = array_shift($formData);
        
        $regM = M('pool');

        $result = $regM -> where("id=$id") -> save($formData);

        echo $result;
    }

}